<?php


namespace EchoPHP\Database\Query\Grammar;


class OracleGrammar extends Grammar {

    /**
     * @inheritDoc
     */
    public function compileSelectLimit($query, int $rowNumFrom, int $rowNumTo, array &$bindings) {
        $query = 'SELECT * FROM ( SELECT rowlimit.*, ROWNUM RN FROM (' . $query . ') rowlimit WHERE ROWNUM <= ? )WHERE RN > ? ';
        $bindings[] = $rowNumTo;
        $bindings[] = $rowNumFrom;
        return $query;
    }
}